/**
 * 设置参数
 */
import queryString from "querystring";
import * as actionType from "./ActionTypes";
import { GET, POST } from "@/common/httpServer/Request";
import {
  orderList, // 获取订单信息
  orderPayList,//历史订单
  orderCreate,//酒代预约
  orderPay,// 支付接口
  orderDetail,//订单详情
  orderCreateRoom,//预约房间
  orderCancel,//取消预订
  orderBarmaidList,//酒待管理请求数据订单总数
  orderNow,//当前订单
} from "@/common/httpServer/AjaxMap";
//酒待管理请求数据订单总数
export function getOrderBarmaidList() {
  return dispatch => {
    return GET(`${orderOrBarmaidList}?${queryString.stringify(params)}`)
      .then(data => {
        dispatch(orderOrBarmaidList(data));
        return data;
      })
      .catch(error => {
        dispatch(orderOrBarmaidList({}));
        return error;
      });
  };
}
function orderOrBarmaidList(data) {
  return {
    type: actionType.GET_ORDERBARMAIDLIST_DATA_SUCCESS,
    data
  };
}

//获取当前订单信息
export function getOrderNowData(){
  return dispatch=>{
    return GET(`${orderNow}`)
    .then(data=>{
      dispatch(getOrOrderNowData(data))
      return data 
    })
    .catch(error=>{
      dispatch(getOrOrderNowData(error))
      return error
    })
  }
}
function getOrOrderNowData(data){
  return {
    type:actionType.GET_ORDERNOW_DATA_SUCCESS,
    data
  }
}

